<script setup lang="ts">
import { ref } from "vue";
import { formRules } from "./utils/rule";
import { FormProps } from "./utils/types";
import type { FormInstance } from "element-plus";

const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({
    id: "",
    customer_id: "",
    table_at: "",
    version: "",
    content: ""
  })
});

const ruleFormRef = ref<FormInstance>();
const newFormInline = ref(props.formInline);

function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>

<template>
  <div>
    <el-form
      ref="ruleFormRef"
      :rules="formRules"
      :model="newFormInline"
      label-position="top"
    >
      <el-form-item label="" prop="content">
        <el-input type="textarea" :rows="4" v-model="newFormInline.content" placeholder="请输入" />
      </el-form-item>
    </el-form>
  </div>
</template>
